<template>
	<my-field :label="data.label" :needRightIcon="false">
		<u-input v-if="'Phone,Password,InputNumber'.indexOf(data.type) > -1"
			v-model="obj.value"
			clearable
			:type="data.type=='Password'?'password':(data.type=='Input'?'text':'number')"
			:disabled="data.readonly"
			:placeholder="data.readonly?'':(data.config.placeholder || '')"
			></u-input>
		<u-textarea v-else
			v-model="obj.value"
			:height="95"
			:disabled="data.readonly"
			:placeholder="data.readonly?'':(data.config.placeholder || '')"></u-textarea>
	</my-field>
</template>
<script>
import MyField from '@/pages_form/components/my-field.vue'
export default {
	components: {MyField},
    props: {
        data: {
            type: Object,
			required: true
        }
    },
	data() {
		return {
			obj: JSON.parse(JSON.stringify(this.data))
		}
	},
    watch:{
       obj: {
		   deep: true,
		   handler() {
			   this.$emit('fieldValueChange', this.obj)
		   }
	   }
    },
	methods: {
	}
}
</script>

<style>
	/deep/ .u-textarea {
		padding: 9px 9px 9px 0px !important;
	}
</style>